﻿Imports System.Xml.Serialization
Imports System.IO

Public Class Settings
    Private _xboxMap As String
    Private _XboxTag As String
    Private _ceMap As String
    Private _ceTag As String

    Private _FtpUsername As String
    Private _FtpPassword As String
    Private _FtpDirectory As String
    Private _FtpAddress As String

    Private _renderCTF As Boolean = True
    Private _renderRace As Boolean = True
    Private _renderKOTH As Boolean = True
    Private _renderTeleport As Boolean = True
    Private _renderSpawn As Boolean = True
    Private _renderOddball As Boolean = True
    Private _renderAI As Boolean = True

    Private _renderScenery As Boolean = True
    Private _renderBipeds As Boolean = True
    Private _renderVehicles As Boolean = True
    Private _renderEquipment As Boolean = True
    Private _renderWeapons As Boolean = True
    Private _renderMachines As Boolean = True
    Private _renderControls As Boolean = True
    Private _renderLightFixtures As Boolean = True
    Private _renderSoundScenery As Boolean = True

    Private _colorCTF As Color = Color.Gray
    Private _colorRace As Color = Color.Fuchsia
    Private _colorKOTH As Color = Color.Orange
    Private _colorTeleport As Color = Color.Green
    Private _colorSpawnDefault As Color = Color.Yellow
    Private _colorSpawnRed As Color = Color.Red
    Private _colorSpawnBlue As Color = Color.Blue
    Private _colorOddball As Color = Color.WhiteSmoke
    Private _colorAIMove As Color = Color.Black
    Private _colorAISpawn As Color = Color.Brown

    Private _dockingLocation As String
    Private _palVersion As Boolean = False


    Public Shared Function Load() As Settings
        Dim fsSettings As New FileStream("settings.xml", FileMode.OpenOrCreate)
        Dim xmlSerializer As New XmlSerializer(GetType(Arsenic.Settings))
        Dim nSettings As Arsenic.Settings
        Try
            nSettings = xmlSerializer.Deserialize(fsSettings)
        Catch
            nSettings = Nothing
        End Try
        fsSettings.Close()
        Return nSettings
    End Function
    Public Sub Save()
        Dim fsSettings As New FileStream("settings.xml", FileMode.Create)
        Dim xmlSerializer As New XmlSerializer(GetType(Arsenic.Settings))
        xmlSerializer.Serialize(fsSettings, Me)
        fsSettings.Close()
    End Sub

    <System.ComponentModel.Category("XBOX FTP")> _
Public Property FTP_Username() As String
        Get
            Return _FtpUsername
        End Get
        Set(ByVal value As String)
            _FtpUsername = value
        End Set
    End Property
    <System.ComponentModel.Category("XBOX FTP")> _
Public Property FTP_Password() As String
        Get
            Return _FtpPassword
        End Get
        Set(ByVal value As String)
            _FtpPassword = value
        End Set
    End Property
    <System.ComponentModel.Category("XBOX FTP")> _
Public Property FTP_Directory() As String
        Get
            Return _FtpDirectory
        End Get
        Set(ByVal value As String)
            _FtpDirectory = value
        End Set
    End Property
    <System.ComponentModel.Category("XBOX FTP")> _
Public Property FTP_Address() As String
        Get
            Return _FtpAddress
        End Get
        Set(ByVal value As String)
            _FtpAddress = value
        End Set
    End Property
    <System.ComponentModel.Category("Compile Options")> _
Public Property PAL_Version() As Boolean
        Get
            Return _palVersion
        End Get
        Set(ByVal value As Boolean)
            _palVersion = value
        End Set
    End Property

    <System.ComponentModel.Category("Locations"), _
    System.ComponentModel.Editor(GetType(System.Windows.Forms.Design.FolderNameEditor), GetType(System.Drawing.Design.UITypeEditor))> _
    Public Property XboxMapFolder() As String
        Get
            Return _xboxMap
        End Get
        Set(ByVal value As String)
            _xboxMap = value
        End Set
    End Property
    <System.ComponentModel.Category("Locations"), _
    System.ComponentModel.Editor(GetType(System.Windows.Forms.Design.FolderNameEditor), GetType(System.Drawing.Design.UITypeEditor))> _
    Public Property XboxTagFolder() As String
        Get
            Return _XboxTag
        End Get
        Set(ByVal value As String)
            _XboxTag = value
        End Set
    End Property
    <System.ComponentModel.Category("Locations"), _
    System.ComponentModel.Editor(GetType(System.Windows.Forms.Design.FolderNameEditor), GetType(System.Drawing.Design.UITypeEditor))> _
    Public Property CEMapFolder() As String
        Get
            Return _ceMap
        End Get
        Set(ByVal value As String)
            _ceMap = value
        End Set
    End Property
    <System.ComponentModel.Category("Locations"), _
    System.ComponentModel.Editor(GetType(System.Windows.Forms.Design.FolderNameEditor), GetType(System.Drawing.Design.UITypeEditor))> _
    Public Property CETagFolder() As String
        Get
            Return _ceTag
        End Get
        Set(ByVal value As String)
            _ceTag = value
        End Set
    End Property

    <System.ComponentModel.Category("Toggles")> _
 Public Property RenderCTF() As Boolean
        Get
            Return _renderCTF
        End Get
        Set(ByVal value As Boolean)
            _renderCTF = value
        End Set
    End Property
    <System.ComponentModel.Category("Toggles")> _
    Public Property RenderRace() As Boolean
        Get
            Return _renderRace
        End Get
        Set(ByVal value As Boolean)
            _renderRace = value
        End Set
    End Property
    <System.ComponentModel.Category("Toggles")> _
    Public Property RenderKOTH() As Boolean
        Get
            Return _renderKOTH
        End Get
        Set(ByVal value As Boolean)
            _renderKOTH = value
        End Set
    End Property
    <System.ComponentModel.Category("Toggles")> _
    Public Property RenderTeleport() As Boolean
        Get
            Return _renderTeleport
        End Get
        Set(ByVal value As Boolean)
            _renderTeleport = value
        End Set
    End Property
    <System.ComponentModel.Category("Toggles")> _
    Public Property RenderSpawn() As Boolean
        Get
            Return _renderSpawn
        End Get
        Set(ByVal value As Boolean)
            _renderSpawn = value
        End Set
    End Property
    <System.ComponentModel.Category("Toggles")> _
    Public Property RenderOddball() As Boolean
        Get
            Return _renderOddball
        End Get
        Set(ByVal value As Boolean)
            _renderOddball = value
        End Set
    End Property
    <System.ComponentModel.Category("Toggles")> _
    Public Property RenderAI() As Boolean
        Get
            Return _renderAI
        End Get
        Set(ByVal value As Boolean)
            _renderAI = value
        End Set
    End Property

    <System.ComponentModel.Category("Render")> _
Public Property Scenery() As Boolean
        Get
            Return _renderScenery
        End Get
        Set(ByVal value As Boolean)
            _renderScenery = value
        End Set
    End Property
    <System.ComponentModel.Category("Render")> _
Public Property Bipeds() As Boolean
        Get
            Return _renderBipeds
        End Get
        Set(ByVal value As Boolean)
            _renderBipeds = value
        End Set
    End Property
    <System.ComponentModel.Category("Render")> _
Public Property Vehicles() As Boolean
        Get
            Return _renderVehicles
        End Get
        Set(ByVal value As Boolean)
            _renderVehicles = value
        End Set
    End Property
    <System.ComponentModel.Category("Render")> _
Public Property Equipment() As Boolean
        Get
            Return _renderEquipment
        End Get
        Set(ByVal value As Boolean)
            _renderEquipment = value
        End Set
    End Property
    <System.ComponentModel.Category("Render")> _
Public Property Weapons() As Boolean
        Get
            Return _renderWeapons
        End Get
        Set(ByVal value As Boolean)
            _renderWeapons = value
        End Set
    End Property
    <System.ComponentModel.Category("Render")> _
Public Property Machines() As Boolean
        Get
            Return _renderMachines
        End Get
        Set(ByVal value As Boolean)
            _renderMachines = value
        End Set
    End Property
    <System.ComponentModel.Category("Render")> _
Public Property Controls() As Boolean
        Get
            Return _renderControls
        End Get
        Set(ByVal value As Boolean)
            _renderControls = value
        End Set
    End Property
    <System.ComponentModel.Category("Render")> _
Public Property LightFixtures() As Boolean
        Get
            Return _renderLightFixtures
        End Get
        Set(ByVal value As Boolean)
            _renderLightFixtures = value
        End Set
    End Property
    <System.ComponentModel.Category("Render")> _
Public Property SoundScenery() As Boolean
        Get
            Return _renderSoundScenery
        End Get
        Set(ByVal value As Boolean)
            _renderSoundScenery = value
        End Set
    End Property

    <XmlIgnoreAttribute(), _
    System.ComponentModel.Category("Colors")> _
    Public Property CTF() As Color
        Get
            Return _colorCTF
        End Get
        Set(ByVal value As Color)
            _colorCTF = value
        End Set
    End Property
    <XmlIgnoreAttribute(), _
    System.ComponentModel.Category("Colors")> _
Public Property Race() As Color
        Get
            Return _colorRace
        End Get
        Set(ByVal value As Color)
            _colorRace = value
        End Set
    End Property
    <XmlIgnoreAttribute(), _
    System.ComponentModel.Category("Colors")> _
    Public Property KOTH() As Color
        Get
            Return _colorKOTH
        End Get
        Set(ByVal value As Color)
            _colorKOTH = value
        End Set
    End Property
    <XmlIgnoreAttribute(), _
    System.ComponentModel.Category("Colors")> _
Public Property Teleport() As Color
        Get
            Return _colorTeleport
        End Get
        Set(ByVal value As Color)
            _colorTeleport = value
        End Set
    End Property
    <XmlIgnoreAttribute(), _
    System.ComponentModel.Category("Colors")> _
Public Property SpawnDefault() As Color
        Get
            Return _colorSpawnDefault
        End Get
        Set(ByVal value As Color)
            _colorSpawnDefault = value
        End Set
    End Property
    <XmlIgnoreAttribute(), _
System.ComponentModel.Category("Colors")> _
Public Property SpawnRed() As Color
        Get
            Return _colorSpawnRed
        End Get
        Set(ByVal value As Color)
            _colorSpawnRed = value
        End Set
    End Property
    <XmlIgnoreAttribute(), _
System.ComponentModel.Category("Colors")> _
Public Property SpawnBlue() As Color
        Get
            Return _colorSpawnBlue
        End Get
        Set(ByVal value As Color)
            _colorSpawnBlue = value
        End Set
    End Property
    <XmlIgnoreAttribute(), _
    System.ComponentModel.Category("Colors")> _
Public Property Oddball() As Color
        Get
            Return _colorOddball
        End Get
        Set(ByVal value As Color)
            _colorOddball = value
        End Set
    End Property
    <XmlIgnoreAttribute(), _
    System.ComponentModel.Category("Colors")> _
Public Property AISpawn() As Color
        Get
            Return _colorAISpawn
        End Get
        Set(ByVal value As Color)
            _colorAISpawn = value
        End Set
    End Property
    <XmlIgnoreAttribute(), _
    System.ComponentModel.Category("Colors")> _
Public Property AIMove() As Color
        Get
            Return _colorAIMove
        End Get
        Set(ByVal value As Color)
            _colorAIMove = value
        End Set
    End Property

    <System.ComponentModel.Browsable(False)> _
    Public Property intCTF() As Integer
        Get
            Return _colorCTF.ToArgb
        End Get
        Set(ByVal value As Integer)
            _colorCTF = Color.FromArgb(value)
        End Set
    End Property
    <System.ComponentModel.Browsable(False)> _
Public Property intRace() As Integer
        Get
            Return _colorRace.ToArgb
        End Get
        Set(ByVal value As Integer)
            _colorRace = Color.FromArgb(value)
        End Set
    End Property
    <System.ComponentModel.Browsable(False)> _
Public Property intKOTH() As Integer
        Get
            Return _colorKOTH.ToArgb
        End Get
        Set(ByVal value As Integer)
            _colorKOTH = Color.FromArgb(value)
        End Set
    End Property
    <System.ComponentModel.Browsable(False)> _
Public Property intTeleport() As Integer
        Get
            Return _colorTeleport.ToArgb
        End Get
        Set(ByVal value As Integer)
            _colorTeleport = Color.FromArgb(value)
        End Set
    End Property
    <System.ComponentModel.Browsable(False)> _
Public Property intSpawn() As Integer
        Get
            Return _colorSpawnDefault.ToArgb
        End Get
        Set(ByVal value As Integer)
            _colorSpawnDefault = Color.FromArgb(value)
        End Set
    End Property
    <System.ComponentModel.Browsable(False)> _
Public Property intSpawnRed() As Integer
        Get
            Return _colorSpawnRed.ToArgb
        End Get
        Set(ByVal value As Integer)
            _colorSpawnRed = Color.FromArgb(value)
        End Set
    End Property
    <System.ComponentModel.Browsable(False)> _
Public Property intSpawnBlue() As Integer
        Get
            Return _colorSpawnBlue.ToArgb
        End Get
        Set(ByVal value As Integer)
            _colorSpawnBlue = Color.FromArgb(value)
        End Set
    End Property
    <System.ComponentModel.Browsable(False)> _
Public Property intOddball() As Integer
        Get
            Return _colorOddball.ToArgb
        End Get
        Set(ByVal value As Integer)
            _colorOddball = Color.FromArgb(value)
        End Set
    End Property
    <System.ComponentModel.Browsable(False)> _
Public Property intAISpawn() As Integer
        Get
            Return _colorAISpawn.ToArgb
        End Get
        Set(ByVal value As Integer)
            _colorAISpawn = Color.FromArgb(value)
        End Set
    End Property
    <System.ComponentModel.Browsable(False)> _
Public Property intAIMove() As Integer
        Get
            Return _colorAIMove.ToArgb
        End Get
        Set(ByVal value As Integer)
            _colorAIMove = Color.FromArgb(value)
        End Set
    End Property
    <System.ComponentModel.Browsable(False)> _
Public Property WindowPlacements() As String
        Get
            Return _dockingLocation
        End Get
        Set(ByVal value As String)
            _dockingLocation = value
        End Set
    End Property
End Class